<?php
function connectUserTag($record, $requestContext)
{
	$sessionInfo = $requestContext->sessionInfo;
	// params->member_type was obtained by doing a custom SQL query at the server.
	if (isset($record->params->member_type)) {
		if ($record->params->member_type == 'owner') {
			return '[MINE]';// it's mine, show nothing
		} else {
			return "[$record->params->member_type]";
		}
	}
	$retval = '<a href="'. controller_base_path($requestContext).'/Connection/invite?coUserSid='.$record->sid.'">Connect</a> ';
	if ( isset($sessionInfo->currentProjectSid) && $sessionInfo->currentProjectSid > 0) {
		$retval = $retval.' | <a href="'. controller_base_path($requestContext).'/Project/'.$sessionInfo->currentProjectSid.'/invite?userSid='.$record->sid.'&type=collab">Invite to Project</a>';
	}
	return $retval;
}

function display_userbox($record, $requestContext)
{
	$sessionInfo = $requestContext->sessionInfo;
?>
							<div style="width:100%; display:inline-block;">
								<img src="<?php echo profile_img_url( $record->creatorDto->profileImageSid, 40) ?>" style="float:left; padding:5px">
								<div style="margin-right:50px"><b><a href="<?php echo controller_base_path($requestContext).'/Profile?userSid='.$record->creatorSid;?>"><?php echo $record->creatorDto->displayName; ?></a></b> from <?php echo $record->currentLocation; ?><br />
									<?php echo $record->highlight; ?>
									<p>Skills: <?php echo $record->skillTagNamesCsv; ?></p>
									<div style="float:right"><?php echo connectUserTag($record, $requestContext); ?></div>
								</div>
								<br />
							</div>
<?php
}
?>

